/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.bankroll.poker.view;

import br.com.bankroll.poker.bean.BankRoll;
import br.com.bankroll.poker.dao.IBankRollDAO;
import br.com.bankroll.poker.facotry.DaoFactory;
import br.com.bankroll.poker.view.grafico.Grafico;
import javax.swing.JFrame;

/**
 *
 * @author aluno
 */
public class JFramePrincipal extends javax.swing.JFrame {

    /**
     * Creates new form JFramePrincipal
     */
    public JFramePrincipal() {
        initComponents();        
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jEditorPane1 = new javax.swing.JEditorPane();
        menuPrincipal = new javax.swing.JMenuBar();
        menuArquivo = new javax.swing.JMenu();
        mSair = new javax.swing.JMenuItem();
        menuBankRoll = new javax.swing.JMenu();
        mIncluir = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        mVisualizar = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        menuGrafico = new javax.swing.JMenu();
        mResultados = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("BankRoll");
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setMaximumSize(new java.awt.Dimension(792, 394));

        jScrollPane1.setViewportView(jEditorPane1);

        menuArquivo.setText("Arquivo");

        mSair.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK));
        mSair.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/bankroll/poker/view/icons/exit.png"))); // NOI18N
        mSair.setMnemonic('S');
        mSair.setText("Sair do sistema");
        mSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mSairActionPerformed(evt);
            }
        });
        menuArquivo.add(mSair);

        menuPrincipal.add(menuArquivo);

        menuBankRoll.setMnemonic('d');
        menuBankRoll.setText("BankRoll");

        mIncluir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.ALT_MASK));
        mIncluir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/bankroll/poker/view/icons/poker.png"))); // NOI18N
        mIncluir.setText("Incluir");
        mIncluir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mIncluirActionPerformed(evt);
            }
        });
        menuBankRoll.add(mIncluir);
        menuBankRoll.add(jSeparator1);

        mVisualizar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.ALT_MASK));
        mVisualizar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/bankroll/poker/view/icons/cartas32.png"))); // NOI18N
        mVisualizar.setText("Visualizar Todos");
        mVisualizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mVisualizarActionPerformed(evt);
            }
        });
        menuBankRoll.add(mVisualizar);
        menuBankRoll.add(jSeparator2);

        menuPrincipal.add(menuBankRoll);

        menuGrafico.setText("Gráfico");

        mResultados.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.ALT_MASK));
        mResultados.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/bankroll/poker/view/icons/graph32.png"))); // NOI18N
        mResultados.setText("Resultados");
        mResultados.setName("mResultados"); // NOI18N
        mResultados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mResultadosActionPerformed(evt);
            }
        });
        menuGrafico.add(mResultados);

        menuPrincipal.add(menuGrafico);

        setJMenuBar(menuPrincipal);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel1)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel1)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void mSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mSairActionPerformed
        // TODO add your handling code here:
        dispose();
    }//GEN-LAST:event_mSairActionPerformed

    private void mIncluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mIncluirActionPerformed
        // TODO add your handling code here:
        JFrame f = new JFrameConfiguracao();
        f.pack();
        f.setVisible(true);
    }//GEN-LAST:event_mIncluirActionPerformed

    private void mVisualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mVisualizarActionPerformed
        // TODO add your handling code here:
    /*    JDialog jd = new JDialogCarro(this, true);
        
        CategoriaDAO cdao = new CategoriaDAOImpl();
        List<Categoria> lista = cdao.listarTodos();
        JDialogCarro.setCategoria(lista);
        
        jd.pack();
        jd.setVisible(true);*/
    }//GEN-LAST:event_mVisualizarActionPerformed

    private void mResultadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mResultadosActionPerformed
        Grafico.abrirGrafico();
    }//GEN-LAST:event_mResultadosActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(JFramePrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(JFramePrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(JFramePrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(JFramePrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new JFramePrincipal().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JEditorPane jEditorPane1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JMenuItem mIncluir;
    private javax.swing.JMenuItem mResultados;
    private javax.swing.JMenuItem mSair;
    private javax.swing.JMenuItem mVisualizar;
    private javax.swing.JMenu menuArquivo;
    private javax.swing.JMenu menuBankRoll;
    private javax.swing.JMenu menuGrafico;
    private javax.swing.JMenuBar menuPrincipal;
    // End of variables declaration//GEN-END:variables
}
